/* $Id: extern.h 57 2007-03-25 09:14:34Z aldleonm $
 */
#include <db.h>	/* db_i->pdb */

#define DELIM 10
#define BSZ	512
#define STRSZ BSZ + BSZ

#define CREATE 0
#define READ 1
#define WRITE 2
#define LIST 3
#define DELETE 4
#define STAT 5


int debug;	/* 1=enable, 0=disable */

/*  instance properties
 * 	assigned from the command-line
 */
struct _dbi
{
	char *name;	/* instance name : database name */
	size_t s_name;	/* last string size including NULL */
	char keyname[STRSZ]; /* the -n keyname */
	size_t s_keyname; /* and its size */
	char fname[STRSZ];	/* file name holding the database */
	size_t s_fname;	/* it`s size including NULL */
	char *passw;	/* care must be taken to clean this */
	size_t s_passw;	/* size including NULL */
	int action;	/* 0=create,1=read,2=write,3=list,4=delete,5=stat */
	int action_subopt; /* action suboption: file=0,std{in|out}=1 */
	DB *pdb;
	int item_counter; /* number of total entries in database */
	u_int32_t items_size; /* key.size + data.size = ... */
} dbi;

static struct _dbi *db_i = &dbi;

/* db id
 *  this is filled with the 
 *  contents of the first 
 *  entry in the database;
 *  the database id.
 */
struct _dbid
{
	char name[STRSZ];
	time_t creation_date;
	time_t last_change;
	size_t item_counter;	/* XXX */
} dbid;

static struct _dbid *db_id = &dbid;

/*
 * vim:ts=2
 */
/* END */
